﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="proClase.aspx.cs" Inherits="proClase" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style5
        {
        }
        .style6
        {
            width: 144px;
            text-align: right;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphContenido" Runat="Server">

    <asp:Panel ID="pnlAlta" runat="server" Visible="False">
        <table class="style1" width="600px">
            <tr>
                <td class="style6">
                    &nbsp;Clase</td>
                <td colspan="6">
                    <asp:HiddenField ID="txtIdClase" runat="server" />
                </td>
            </tr>
            <tr>
                <td class="style6">
                    Actividad:</td>
                <td colspan="6">
                    <asp:DropDownList ID="ddlActividad" runat="server" Width="120px">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style6">
                    Profesor:</td>
                <td colspan="6">
                    <asp:DropDownList ID="ddlProfesor" runat="server" Width="120px">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style6">
                    Sala:</td>
                <td colspan="6">
                    <asp:DropDownList ID="ddlSala" runat="server" Width="120px">
                    </asp:DropDownList>
                </td>
            </tr>
        
            </table>
        <asp:Panel ID="pnlHorarios" runat="server">
        
            <table class="style1" width="600px">
                <tr>
                <td class="style6">
                    Horarios</td>
                <td colspan="6">
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style6">
                    Dia:</td>
                <td>
                    <asp:DropDownList ID="ddlDia" runat="server">
                        <asp:ListItem>Lunes</asp:ListItem>
                        <asp:ListItem>Martes</asp:ListItem>
                        <asp:ListItem>Miercoles</asp:ListItem>
                        <asp:ListItem>Jueves</asp:ListItem>
                        <asp:ListItem>Viernes</asp:ListItem>
                        <asp:ListItem>Sabado</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td style="text-align: right">
                    Hora inicio:</td>
                <td>
                    <asp:DropDownList ID="ddlHoraInicio" runat="server" Width="50px">
                    </asp:DropDownList>
                    :
                    <asp:DropDownList ID="ddlMinutosInicio" runat="server" Width="50px">
                    </asp:DropDownList>
                </td>
                <td style="text-align: right">
                    Hora fin:</td>
                <td>
                    <asp:DropDownList ID="ddlHoraFin" runat="server" Width="50px">
                    </asp:DropDownList>
                    :
                    <asp:DropDownList ID="ddlMinutosFin" runat="server" Width="50px">
                    </asp:DropDownList>
                </td>
                <td>
                    <asp:Button ID="ddlAgregarHorario" runat="server" Text="Agregar Horario" 
                        onclick="ddlAgregarHorario_Click" />
                </td>
            </tr>
            <tr>
                <td class="style5" colspan="7">
                    <asp:Label ID="lblHorario" runat="server"></asp:Label>
                    <br />
                    <asp:GridView ID="dgvHorarios" runat="server" AutoGenerateColumns="False" 
                        onrowcommand="dgvHorarios_RowCommand">
                        <Columns>
                            <asp:BoundField HeaderText="Día" DataField="Dia" />
                            <asp:BoundField HeaderText="Hora Inicio" DataField="HoraInicio" />
                            <asp:BoundField HeaderText="Hora Fin" DataField="HoraFin" />
                            <asp:TemplateField HeaderText="Eliminar">
                                <ItemTemplate>
                                    <asp:Button ID="btnEliminar" runat="server" Text="Eliminar" CommandName="EliminarHorario" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                </td>
            </tr>
                    </table>
        </asp:Panel>
          <table class="style1" width="600px">
            <tr>
                <td class="style6">
                    &nbsp;</td>
                <td colspan="6">
                    <asp:Button ID="btnAgregarClase" runat="server" onclick="btnAgregarClase_Click" 
                        Text="Agregar Clase" />
                    <asp:Button ID="btnModificarClase" runat="server" 
                        onclick="btnModificarClase_Click" Text="Modificar Clase" />
                    <asp:Button ID="btnVolverListado" runat="server" 
                        onclick="btnVolverListado_Click" Text="Volver Atras" Width="106px" />
                </td>
            </tr>
            </table>
    </asp:Panel>
    <asp:Panel ID="pnlListado" runat="server">
        <asp:Button ID="btnNuevaClase" runat="server" onclick="btnNuevaClase_Click" 
            Text="Nueva Clase" />
        <br />
        <asp:GridView ID="dgvClase" runat="server" AutoGenerateColumns="False" 
            AllowPaging="True" onpageindexchanging="dgvClase_PageIndexChanging">
            <Columns>
                <asp:BoundField DataField="Id" HeaderText="Id" Visible="False" />
                <asp:BoundField DataField="Actividad.Descripcion" HeaderText="Actividad" />
                <asp:BoundField DataField="Profesor.nombreApellido" HeaderText="Profesor" />
                <asp:BoundField DataField="Sala.Descripcion" HeaderText="Sala" />
                <asp:BoundField DataField="mostrarHorarios" HeaderText="Horarios" HtmlEncode="false"  />
                <asp:TemplateField HeaderText="Clase">
                    <ItemTemplate>
                        <asp:Button ID="btnModificar" runat="server" Text="Modificar" oncommand="btnEliminar_Command" CommandName="ModificarClase" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"/>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Horarios">
                    <ItemTemplate>
                        <asp:Button ID="btnModificarHorario" runat="server" Height="26px" Text="Modificar" oncommand="btnEliminar_Command" CommandName="ModificarHorario" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Eliminar">
                    <ItemTemplate>
                        <asp:Button ID="btnEliminar" runat="server" Text="Eliminar" 
                            CommandName="EliminarClase" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" 
                        onclientclick="if(!confirm('¿Esta seguro que desea de baja clase seleccionada? Si lo hace se borraran sus horarios y alumnos inscriptos')){return false;}"
                        oncommand="btnEliminar_Command"
                        />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Editar Alumnos">
                    <ItemTemplate>
                        <asp:Button ID="btnEditarAlumnos" runat="server" Text="Alumnos" oncommand="btnEliminar_Command" CommandName="AgregarAlumnos" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"/>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </asp:Panel>
    <asp:Label ID="lblError" runat="server" ForeColor="Red"></asp:Label>

</asp:Content>

